<?php

namespace App\Services;

class SmsService
{
    /**
     * 发送短信
     *
     * @param string $phone 手机号
     * @param string $message 短信内容
     * @return array
     */
    public function sendSms($phone, $message)
    {
        // Mock实现 - 假定发送成功
        \Log::info('SMS Mock: 发送短信', [
            'phone' => $phone,
            'message' => $message
        ]);
        
        return [
            'success' => true,
            'message_id' => 'mock_' . uniqid(),
            'status' => 'sent'
        ];
    }
    
    /**
     * 发送结算通知短信
     *
     * @param string $phone
     * @param float $amount
     * @param string $status
     * @return array
     */
    public function sendSettlementNotification($phone, $amount, $status)
    {
        $statusText = [
            'approved' => '已批准',
            'completed' => '已完成',
            'rejected' => '已拒绝'
        ][$status] ?? $status;
        
        $message = "您的结算申请（金额：￥{$amount}）状态已更新为：{$statusText}";
        
        return $this->sendSms($phone, $message);
    }
}